home *** CD-ROM | disk | FTP | other *** search
/ mail.altrad.com / 2015.02.mail.altrad.com.tar / mail.altrad.com / TEST / office deutch / INFOPATH.NL-NL / INFLR.CAB / FL_iterindex_snippet_121845_ENU____.3643236F_FC70_11D3_A536_0090278A1BB8 < prev    next >
Extensible Markup Language  |  2005-08-12  |  3KB  |  84 lines

  1. ∩╗┐<?xml version="1.0" encoding="utf-8" ?>
  2. <CodeSnippets  xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
  3.     <CodeSnippet Format="1.0.0">
  4.         <Header>
  5.             <Title>iterindex</Title>
  6.             <Shortcut>iterindex</Shortcut>
  7.             <Description>Code snippet for 'named' iterator/indexer pair using a nested class</Description>
  8.             <Author>Microsoft Corporation</Author>
  9.             <SnippetTypes>
  10.                 <SnippetType>Expansion</SnippetType>
  11.             </SnippetTypes>
  12.         </Header>
  13.         <Snippet>
  14.             <Declarations>
  15.                 <Literal>
  16.                     <ID>type</ID>
  17.                     <Default>ElementType</Default>
  18.                     <ToolTip>Type to return from iterator/indexer</ToolTip>
  19.                 </Literal>
  20.                 <Literal>
  21.                     <ID>name</ID>
  22.                     <Default>MyView</Default>
  23.                     <ToolTip>Name of the iterator/indexer pair</ToolTip>
  24.                 </Literal>
  25.                 <Literal Editable="false">
  26.                     <ID>outer</ID>
  27.                     <Default>MyOuterClass</Default>
  28.                     <Function>ClassName()</Function>
  29.                 </Literal>
  30.                 <Literal Editable="false">
  31.                     <ID>SystemCollectionsGenericIEnumeratorG</ID>
  32.                     <Default>System.Collections.Generic.IEnumerator</Default>
  33.                 </Literal>
  34.                 <Literal Editable="false">
  35.                     <ID>Exception</ID>
  36.                     <Function>SimpleTypeName(global::System.Exception)</Function>
  37.                 </Literal>
  38.             </Declarations>
  39.             <Code Language="csharp"><![CDATA[public $name$Iterator $name$
  40.         {
  41.             get
  42.             {
  43.                 return new $name$Iterator(this);
  44.             }
  45.         }
  46.  
  47.         public class $name$Iterator
  48.         {
  49.             readonly $outer$ outer;
  50.  
  51.             internal $name$Iterator($outer$ outer)
  52.             {
  53.                 this.outer = outer;
  54.             }
  55.  
  56.             // TODO: provide an appropriate implementation here
  57.             public int Length { get { return 1; } }
  58.  
  59.             public $type$ this[int index]
  60.             {
  61.                 get
  62.                 {
  63.                     //
  64.                     // TODO: implement indexer here
  65.                     //
  66.                     // you have full access to $outer$ privates.
  67.                     //
  68.                     $end$throw new $Exception$("The method or operation is not implemented.");
  69.                     return default($type$);
  70.                 }
  71.             }
  72.  
  73.             public $SystemCollectionsGenericIEnumeratorG$<$type$> GetEnumerator()
  74.             {
  75.                 for (int i = 0; i < this.Length; i++)
  76.                 {                 
  77.                     yield return this[i];
  78.                 }
  79.             }
  80.         }]]>
  81.             </Code>
  82.         </Snippet>
  83.     </CodeSnippet>
  84. </CodeSnippets>